package jea.machine;

import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JPanel;


public class PanelGraphic extends JPanel
{
	private static final long serialVersionUID = 1L;
	private Graphics2D g2d;
	
	private void drawProfile()
	{
		BasicStroke stroke;
        g2d.setColor(Color.BLACK);
		float strokeThickness = 3.0f;
		stroke = new BasicStroke(strokeThickness);
		g2d.setStroke(stroke);
		g2d.drawRect(0,0,400, 400);
		
		g2d.setColor(Color.LIGHT_GRAY);
		stroke = new BasicStroke(strokeThickness);
		g2d.setStroke(stroke);
		g2d.drawArc(100,100,200,200,0,360);
	}
	
	@Override
     public void paintComponent(Graphics g)
     {
            super.paintComponent(g);
            g2d = (Graphics2D) g;
            g2d.setRenderingHint(
               RenderingHints.KEY_ANTIALIASING,
               RenderingHints.VALUE_ANTIALIAS_ON);
            //set color to black
            g2d.setColor(Color.BLACK);
            //draw a rectangle
            /*
            g2d.drawRect(10, 10, 200, 200);
            //draw random circles
            for (int i = 0; i < 20; i++) {
              //set random color
              g2d.setColor(new Color((int) (Math.random() * 255),
                                   (int) (Math.random() * 255),
                                   (int) (Math.random() * 255)));
              g2d.fillOval(20 + (int) (Math.random() * 180),
                         20 + (int) (Math.random() * 180), 5, 5);
            }
            //set color to black
            g2d.setColor(Color.RED);
            //draw a string
            g2d.drawString("developers-blog.org", 20, 20);
            */
            drawProfile();

            //System.out.println("Repainting.");
        }
} 
